package com.chaochis.wind.user.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chaochis.wind.vo.BaseVo;
import com.chaochis.wind.enums.AccountType;
import com.chaochis.wind.enums.DataStatus;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 风旅系统账户表
 * @author 刘超/chaochis
 */
@Getter
@Setter
@ToString
@TableName("wind_account")
public class WindAccount implements Serializable, BaseVo {
  /**
   * 账户id
   */
  @TableId("account_id")
  private String accountId;

  /**
   * 登录账户
   */
  @TableField("account_name")
  private String accountName;

  /**
   * 账户类别
   */
  @TableField("account_type")
  private AccountType accountType;

  /**
   * 账户类别中文解释
   */
  @TableField("account_type_text")
  private String accountTypeText;


  /**
   * 用户昵称
   */
  @TableField(exist = false)
  @JsonIgnore
  private String cusUserNickName;

  /**
   * 账户绑定得人得userId
   */
  @TableField("user_id")
  private String userId;

  /**
   * 创建人
   */
  @TableField("create_by_id")
  private String createById;

  /**
   * 创建该账号的ip地址
   */
  @TableField("create_by_ip")
  private String createByIp;

  /**
   * 创建该记录的时间
   */
  @TableField("create_date")
  @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
  @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
  @JsonDeserialize(using = LocalDateTimeDeserializer.class)
  @JsonSerialize(using = LocalDateTimeSerializer.class)
  private LocalDateTime createDate;

  /**
   * 更新人的userId
   */
  @TableField("update_by_id")
  private String updateById;

  /**
   * 更新该账号的ip地址
   */
  @TableField("update_by_ip")
  private String updateByIp;

  /**
   * 更新的时间
   */
  @TableField("update_date")
  @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
  @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
  @JsonDeserialize(using = LocalDateTimeDeserializer.class)
  @JsonSerialize(using = LocalDateTimeSerializer.class)
  private LocalDateTime updateDate;

  /**
   * 最近一次登录ip
   */
  @TableField("login_ip")
  private String loginIp;

  /**
   * 最近一次登录时间
   */
  @TableField("login_date")
  @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
  @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
  @JsonDeserialize(using = LocalDateTimeDeserializer.class)
  @JsonSerialize(using = LocalDateTimeSerializer.class)
  private LocalDateTime loginDate;

  /**
   * 用户加密密码
   */
  @TableField("account_password")
  private String accountPassword;
  /**
   * 盐值
   */
  @TableField("account_password_salt")
  private String accountPasswordSalt;

  /**
   * 用户账号状态
   */
  @JsonIgnore
  @TableField(exist = false)
  private DataStatus cusAccountStatus;
}
